<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->params['static'].'assets/js/bootbox.min.js',2); ?>
<div class="page-header">
							<h1>
							审核学生资料
							</h1>
</div>
<div class="row">
<div class="col-xs-12">
<div class="row">
<div class="col-xs-12">
										<div class="widget-box">
											<div class="widget-header widget-header-small">
												<h5 class="lighter">查询</h5>
											</div>

											<div class="widget-body">
												<div class="widget-main">
													<?php $this->renderPartial("_searchform",array('classRooms'=>$classRooms,'major'=>$major)); ?>
												</div>
											</div>
										</div>
										
</div>
</div>
<div class="hr hr-18 dotted hr-double"></div>
<div class="row">

		<div class="col-xs-12">
		    <div class="widget-box">
											<div class="widget-header widget-header-small">
												<h5>共检索出：<?php echo $total; ?> 条数据</h5>
											</div>

											<div class="widget-body">
												<div class="widget-main">
											<div class="table-responsive">
										<div class="table-responsive">
									<form id="checkstuinfo">
										<table id="sample-table-1" class="table table-striped table-bordered table-hover">
												<thead>
													<tr>
													   <th class="center">
															<label>
																<input type="checkbox" class="ace">
																<span class="lbl"></span>
															</label>
														</th>
													   <th>姓名</th>
														<th>手机号</th>
														<th>家庭住址</th>
														<th>
														定向区县
														</th>
														<th>
														家长电话
														</th>
														<th>
														身份证
														</th>
														<th>
														银行卡号
														</th>
														<th>
													    银行
														</th>
														
														<th>
														<i class="icon-wrench"></i>
														操作
														</th>
													</tr>
												</thead>
<tbody>
												<?php
											    foreach($stus as $s){
													$extraData = '班级：'.$s->classRoom.'<br>年级：'.$s->grade.'<br>专业：'.$s->major.'<br>学号：'.$s->user->username;
												echo'	
												
												<tr data-rel="tooltip" data-original-title="'.$extraData.'" id="'.$s->uId.'">
												<td class="center">
													<label>
														<input type="checkbox" class="ace" value = "'.$s->uId.'" name="l">
														<span class="lbl"></span>
													</label>
												</td>
												<td>'.$s->realName.'</td>
												<td>'.$s->phoneNum.'</td>
												<td>'.$s->homePlace.'</td>
												<td>'.$s->directionalDistrict.'</td>
												<td>'.$s->parentNum.'</td>
												<td>'.$s->idNum.'</td>
												<td>'.$s->bankNum.'</td>
												<td>'.$s->bankName.'</td>
												
												<td>
															<div >
												              
																<a target="_blank" >
																<button class="btn btn-xs btn-warning" thumbs-down="'.$s->uId.'"  stuInfoId  = "'.$s->stuInfoId.'" >
																	<i class="icon-thumbs-down bigger-120"></i>
																</button>
																</a>
																<a target="_blank" >
																<button class="btn btn-xs btn-success" thumbs-up = "'.$s->uId.'" >
																	<i class="icon-thumbs-up bigger-120"></i>
																</button>
																</a>
															</div>

												</td>
											    </tr>';
												
												}
                                               ?>												
											    </tbody>
												
											
											</table>
									       
											
												
								<p>
								  <button class="btn btn-lg btn-success"  id="muti-up">
									<i class="icon-thumbs-up"></i>
										批量通过										
								  </button>
								  <button class="btn btn-lg btn-warning"  id="muti-down">
									<i class="icon-thumbs-down"></i>
										批量否定										
								  </button>
								</p>
								</form>
							</div><!-- /.table-responsive -->
							 <div class="col-xs-12" style="text-align:center">
										     <?php 
											 $this->widget('CLinkPager',array( 
													'htmlOptions'=>array('class'=>'pagination'),
													'cssFile'=>false,
													'header'=>'',    
													'firstPageLabel' => '首页',    
													'lastPageLabel' => '末页',    
													'prevPageLabel' => '上一页',    
													'nextPageLabel' => '下一页',    
													'pages' => $pages,    
													'maxButtonCount'=>13    
												)    
											);    
												
										?>
							</div>
		</div>
     </div>
										
	</div>
	</div>
	</div>
 </div>
 </div>
 </div>
<script type="text/javascript">

			jQuery(function($) {
				$('table th input:checkbox').on('click' , function(){
					var that = this;
					
					$(this).closest('table').find('tr > td:first-child input:checkbox')
					.each(function(){
						this.checked = that.checked;
						$(this).closest('tr').toggleClass('selected');
						
					});
						
				});
				
			  $('#muti-up').on('click',function(){
				  bootbox.confirm('确定要将这些学生通过审核吗？',function(result){
					 if(result){
						  var stus = $('#checkstuinfo').serialize();
					      $.post('<?php echo Yii::app()->createUrl('basicinfo/passmuti'); ?>',{'stus':stus},function(data){
								console.log(data);
								data = $.parseJSON(data);
								if(data){
									bootbox.alert(data['msg'],function(){
										for(i in data['successArray']){
										$('#'+data['successArray'][i]).fadeToggle('800','linear',function(){
									       $(this).remove();
										});
									  }
							        });
									
									
						        }else{
									bootbox.alert('额额，好像服务器君出错了！！',function(){
										
									});
									
								}
								
								
							});    
						 
					 }
				  });
				  
				  return false;
				  
			  });
			  $('#muti-down').on('click',function(){
				  bootbox.confirm('确定要将这些学生不通过审核吗？',function(result){
					  if(result){
						  var stus = $('#checkstuinfo').serialize();
						  $.post('<?php echo Yii::app()->createUrl('basicinfo/unpassmuti'); ?>',{'stus':stus},function(data){
								console.log(data);
								data = $.parseJSON(data);
								if(data){
									bootbox.alert(data['msg'],function(){
										for(i in data['successArray']){
										$('#'+data['successArray'][i]).fadeToggle('800','linear',function(){
									       $(this).remove();
										});
									  }
							        });
									
									
						        }else{
									bootbox.alert('额额，好像服务器君出错了！！',function(){
										
									});
									
								}
								
								
							});    
						  
					  }
				  });
				  
				  return false;
				  
			  });
			 //在审核的过程中添加备注信息
			  $("[thumbs-down]").on('click',function(){
				  var id = $(this).attr('thumbs-down');
				  var stuInfoId = $(this).attr('stuInfoId')
				  bootbox.prompt({
					  title:"添加备注",
					  value: "同学，您的这条记录有误",
					   
					  callback: function(result) {                
						  if (result === null) {                                             
							                              
						  } else {
							$.post('<?php echo Yii::app()->createUrl('basicinfo/addcomment'); ?>',{'uId':id,'stuInfoId':stuInfoId,'comment':result},function(data){
								data = $.parseJSON(data);
								if(data){
									bootbox.alert(data['msg'],function(){
										if(data['code'] == '200'){
										$('#'+id).fadeToggle('800','linear',function(){
									       $(this).remove();
										});
									   
									}
							       
								   });
									
									
						        }else{
									bootbox.alert('额额，好像服务器君出错了！！',function(){
										
									});
									
								}
								
								
							});                       
						  }}
				  });
				   return false;
				  
			  });
			  $("[thumbs-up]").on('click',function(){
				  var id = $(this).attr('thumbs-up');
				  $.post('<?php echo Yii::app()->createUrl('basicinfo/passone'); ?>',{'uId':id},function(data){
                      if(data){
						  data = $.parseJSON(data);
						  bootbox.alert(data['msg'],function(){
						      if(data['code'] == '200'){
										$('#'+id).fadeToggle('800','linear',function(){
									       $(this).remove();
										});
									   
									}
						  });
						  
						  
					  }else{
						  bootbox.alert('抱歉，服务器君好像出错了',function(){
							  
							  
						  });
					  }					  
					  
				  });
				  return false;
				  
			  });
			
				
			})
		
</script>